" vim:ft=vim

Execute(Include base):
  source test/base_vader.vim

Execute(let g:floaterm_autohide = 0):
  " NOTE: Vim does not support multiple popup terminals
  if !has('nvim') | finish | endif
  let g:floaterm_autohide = 0
  Log '# FloatermNew'
    FloatermNew
    let buffer1 = bufnr('%')
    FloatermNew
    let buffer2 = bufnr('%')
    Assert BufWinExists(buffer1)
    Assert BufWinExists(buffer2)

  Log '# FloatermPrev'
    FloatermPrev
    Assert BufWinExists(buffer1)
    Assert BufWinExists(buffer2)

  Log '# FloatermNext'
    FloatermNext
    Assert BufWinExists(buffer1)
    Assert BufWinExists(buffer2)

  FloatermKill!


Execute(let g:floaterm_autohide = 1):
  if !has('nvim') | finish | endif
  let g:floaterm_autohide = 1
  Log '# Overlaied: true'
    Log '  * FloatermNew'
      FloatermNew
      let buffer1 = bufnr('%')
      FloatermNew
      let buffer2 = bufnr('%')
      Assert !BufWinExists(buffer1)
      Assert BufWinExists(buffer2)

    Log '  * FloatermPrev'
      FloatermPrev
      Assert BufWinExists(buffer1)
      Assert !BufWinExists(buffer2)

    Log '  * FloatermNext'
      FloatermNext
      Assert !BufWinExists(buffer1)
      Assert BufWinExists(buffer2)

  Log '# Overlaied: false'
    Log '  * FloatermNew'
      FloatermNew --position=left
      let buffer1 = bufnr('%')
      FloatermNew --position=right
      let buffer2 = bufnr('%')
      Assert BufWinExists(buffer1)
      Assert BufWinExists(buffer2)

    Log '  * FloatermPrev'
      FloatermPrev
      Assert BufWinExists(buffer1)
      Assert BufWinExists(buffer2)

    Log '  * FloatermNext'
      FloatermNext
      Assert BufWinExists(buffer1)
      Assert BufWinExists(buffer2)

  FloatermKill!


Execute(let g:floaterm_autohide = 2):
  if !has('nvim') | finish | endif
  let g:floaterm_autohide = 2
  Log '# FloatermNew'
    FloatermNew --position=left
    let buffer1 = bufnr('%')
    FloatermNew --position=right
    let buffer2 = bufnr('%')
      Assert !BufWinExists(buffer1)
      Assert BufWinExists(buffer2)

  Log '# FloatermPrev'
    FloatermPrev
      Assert BufWinExists(buffer1)
      Assert !BufWinExists(buffer2)

  Log '# FloatermNext'
    FloatermNext
      Assert !BufWinExists(buffer1)
      Assert BufWinExists(buffer2)

  FloatermKill!
  stopinsert
